{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[1, 4], [2, 5], [3, 6]]\n",
      "3\n"
     ]
    }
   ],
   "source": [
    "def transpose(matrix):  \n",
    "    #return [list(row) for row in zip(*matrix)]\n",
    "    transposed = []\n",
    "    rows = len(matrix)\n",
    "    col = len(matrix[0])\n",
    "    for j in range(col):\n",
    "        transposed.append([matrix[i][j] for i in range(rows)])\n",
    "    return transposed\n",
    "matrix = [[1, 2, 3], [4, 5, 6]]\n",
    "print(transpose(matrix))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
